package org.yourorghere;

import com.sun.opengl.util.Animator;
import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.glu.GLU;
import javax.swing.JFrame;


public class SoccerVisualization implements GLEventListener
{
    private GLAutoDrawable drawable;
    private GLCanvas canvas;
    private JFrame frame;

    public static void main(String[] args){
        new SoccerVisualization();
    }

    private SoccerVisualization()
    {
        frame = new JFrame("SoccerVisualization");
        canvas = new GLCanvas();
        canvas.addGLEventListener(this);
        frame.add(canvas);
        frame.setSize(1000, 800);
        frame.setVisible(true);

        Animator animator = new Animator(canvas);
        animator.start();
    }

    public void init(GLAutoDrawable drawable)
    {
        GL gl = drawable.getGL();
        gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        gl.glShadeModel(GL.GL_SMOOTH);
        gl.glEnable(GL.GL_DEPTH_TEST);
    }

    public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
        GL gl = drawable.getGL();
        GLU glu = new GLU();
        gl.glViewport(0, 0, width, height);
        gl.glMatrixMode(GL.GL_PROJECTION);
        gl.glLoadIdentity();
        glu.gluPerspective(45, 4/3, 0.1, 100.0);
        gl.glMatrixMode(GL.GL_MODELVIEW);



    }



    public void display(GLAutoDrawable drawable)
    {
        GL gl = drawable.getGL();
        GLU glu = new GLU();
        //////Dynamically set?
        this.drawable = drawable;


        // Clear the drawing area
        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
        // Reset the current matrix to the "identity"
        gl.glLoadIdentity();


        // Flush all drawing operations to the graphics card
        gl.glFlush();
    }


    public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
    }
}
